/*
 * @Description: 系统设置 - 开放字段设置
 * @Author: Rfan
 * @Date: 2022-03-08 15:54:50
 * @LastEditTime: 2022-06-06 17:45:43
 */

import classNames from 'classnames/bind';
import { OpeningContextProvider } from './contexts/OpeningContext';
import { OpeningRouterTypeContext } from './contexts/OpeningRouterTypeContext';
import NavSidebar from './components/NavSidebar';
import PageContent from './components/PageContent';
import PageLayout from '@/layout/PageLayout';
import { EnumOpeningRouteTypes } from '@/view/system/Opening/dictionaries';
import styles from './styles/opening.module.scss';

const cx = classNames.bind(styles);

interface ISysOpeningProps {
  routerType?: EnumOpeningRouteTypes;
}

export const SystemOpeningPage = (props: ISysOpeningProps) => {
  const { routerType = EnumOpeningRouteTypes.Normal } = props;

  return (
    <OpeningRouterTypeContext.Provider value={{ routerType }}>
      <OpeningContextProvider>
        <PageLayout className={cx('sorting-wrap')} sidebar={<NavSidebar />}>
          <PageContent />
        </PageLayout>
      </OpeningContextProvider>
    </OpeningRouterTypeContext.Provider>
  );
};

const SystemOpening = () => <SystemOpeningPage />;

export default SystemOpening;
